﻿Public Class CSBitError

Private _IdError        As Long
Private _IdRegEvento    As Long 
Private _FechaReg       As Date
Private _Mensaje        As String 



Public  Sub new (ByVal IdRegEvento As Long, ByVal Mensaje As String)

   _IdRegEvento  = IdRegEvento
   
   
     If Mensaje.Length > __MAXLONGITUDMSG__ then 
          _Mensaje = Mensaje.Substring(0, __MAXLONGITUDMSG__-1)  
     else
         _Mensaje = Mensaje 
     End If
       
  
   _IdError =  CServicioLocalSQLServerDB.ObtenerIdRegErrorDB () 

End Sub



Public ReadOnly  Property IdError() As Long 
    Get
        Return _IdError 
    End Get
    
End Property

Public ReadOnly  Property IdRegEvento() As Long 
    Get
        Return _IdRegEvento
    End Get
  
End Property

Public ReadOnly  Property Mensaje() As String
    Get
        Return _Mensaje
    End Get
   
End Property

Public Sub GuardarDetalle(ByVal Campo As String, ByVal Valor As String)    
   CServicioLocalSQLServerDB.GuardarDetalleErrorBit (_IdError,Campo, CUtileria.PrepararCadenaParaSQL(Valor,__MAXLONGITUDMSG__)  ) 
End Sub

Public Sub GuardarDetalles(ByRef lstDetalles As List(Of CTBitErrorDet ))
   CServicioLocalSQLServerDB.GuardarDetallesErrorBit (_IdError,lstDetalles )    
End Sub


End Class


Public Class CTBitErrorDet

 
Private _Campo   As String 
Private _Valor   As String 

Public Sub new(ByVal Campo As String, ByVal Valor As String)   
   _Campo   = Campo 


     If Valor.Length > __MAXLONGITUDMSG__ then 
          _Valor = Valor.Substring(0, __MAXLONGITUDMSG__-1)  
     else
         _Valor = Valor 
     End If
   _Valor   = Valor
End Sub



Public Property Campo() As String
    Get
        Return _Campo 
    End Get
    Set(ByVal value As String)
        _Campo = value
    End Set
End Property


Public Property Valor() As String
    Get
        Return _Valor 
    End Get
    Set(ByVal value As String)
        _Valor = value
    End Set
End Property



End Class